<?php

namespace frontend\models;
use yii\behaviors\TimestampBehavior;
use Yii;

/**
 * This is the model class for table "sms".
 *
 * @property integer $id
 * @property string $mobile
 * @property integer $code
 * @property integer $status
 * @property integer $expired_at
 * @property integer $created_at
 */
class Sms extends \yii\db\ActiveRecord
{

    public $verifyCode;
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'sms';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['mobile'], 'required'],
            [['code', 'status', 'expired_at', 'created_at'], 'integer'],
            [['mobile'], 'string', 'max' => 11],
            [['mobile'], 'match', 'pattern' => '/^1[3456789]\d{9}/'],
//            ['verifyCode', 'captcha'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'mobile' => '手机号',
            'code' => '短信验证码',
            'status' => '状态',
            'expired_at' => '过期时间',
            'created_at' => '发送时间',
        ];
    }
}
